1. Field of the Invention
The present invention relates generally to an image size transforming apparatus and a method for contracting images by a digital differential analysis algorithm and to a record medium storing an image size transform program. More particularly, it relates to an image size transforming apparatus and a method preventing the occurrence of interference fringes upon the dot image contraction and to a record medium storing an image size transform program.
2. Description of the Related Arts
Typical image displaying apparatuses or image processing apparatuses for computers or cellular phones often need images expanded or contracted from original images. Conventional image expansion or contraction processing includes defining a determinant for the transform between original images and expanded or contracted image, finding the inverse determinant, and specifying and collecting the original image pixels relative to the expanded or contracted image pixels to thereby perform the expansion and contraction processing. The inverse matrix based expansion or contraction processing is however slow in processing speed due to its floating-point operations. Hence, to achieve a higher processing speed, the digital differential analysis (hereinafter referred to as DDA) algorithm is employed for the image expansion or contraction. The DDA algorithm based image expansion processing acquires expanded images by setting the expanded image size (pixel counts in the vertical and transverse directions) and processing the original image pixels by use of the overlap pattern for selecting whether the original image pixels are to be overlapped on the expanded image pixels for interpolation or be intactly copied. The DDA algorithm based image contraction processing acquires contracted images by setting the contracted image size (pixel counts in the vertical and transverse directions) and processing the original image pixels by use of the thinning pattern for selecting whether the original image pixels are to be copied onto contracted images or to be thinned out without being copied.
In the event of contracting images having a pattern periodicity such as dot images used for newspaper photographs, etc., however, the DDA algorithm based image contraction processing has suffered the occurrence of striped interference fringes in the expanded or contracted images as a result of the mutual interference between the periodic original image dot pattern and the overlap or thinning pattern due to the periodicity of the overlap pattern or thinning pattern deriving from the DDA algorithm. On the other hand, to implement any desired expansion ratios and contraction ratios, the image expansion or contraction processing not using the DDA algorithm has to prepare and store a great deal of overlap patterns and thinning patterns corresponding thereto, with the result that the storage capacity for storing the patterns becomes disadvantageously larger in spite of rapid processing by pattern use. Furthermore, in the event that the original images are binary images represented by white and black pixels, the pixel data are often represented by bits 1 and 0 on the computer, which may cause slow processing due to the difficulty of handling one-bit data on the computer.
The present invention provides an image size transforming apparatus and method capable of expansion and contraction without generating any interference fringes despite periodic original images such as dot patterns, and a record medium storing an image size transform program therein.
The present invention further provides an image size transforming apparatus and method capable of acquiring expanded and contracted images free from the interference fringes with the reduced number of use patterns of the DDA algorithm, and a record medium storing an image size transform program therein.
The present invention further provides an image size transforming apparatus and method in which the DDA algorithm based image processing is sped up through the conversion of bit data into byte data for handling.
According to a first aspect of the present invention there is provided an image size transforming apparatus comprising a DDA processing unit which creates an image expanded or contracted from an original image by a digital differential analysis (DDA); and an initial value setting unit which sets a random number based initial value as a sum total initial value of the digital differential analysis. Herein, upon the image contraction, the DDA processing unit figures out a DDA sum total at a current pixel position by adding a contracted image size to an initialized DDA sum total, at an original image pixel initial position, but to a DDA sum total figured out at an immediately previous pixel position, at the other pixel positions, the DDA processing unit, if the DDA sum total is not less than the original image size, copying pixels at the current pixel position onto a contracted image and defining the result of subtraction of the image size from the current DDA sum total as the DDA sum total at the next pixel position, the DDA processing unit, if the DDA sum total is less than the original image size, thinning out pixels at the current pixel position without copy thereof and defining the current DDA sum total as the DDA sum total at the next pixel position, the DDA processing unit iterating the above processings. The initial value setting unit determines a random number for each pixel initial position of the original image and defines the remainder when the random number is divided by the original image size as a DDA sum total initial value. For this reason, even though a periodic mesh pattern appears on any original image such as a binary image or a color image, the interference fringes cannot occur on the contracted image due to the random number components contained in the pixel selection determined by the digital differential analysis. The initial value setting unit may generate random numbers by use of a random number table. The random numbers are acquired from the random number table instead of calculation in this manner, and hence an increased processing speed can be achieved.
According to a second aspect of the present invention there is provided an image size transforming apparatus comprising a DDA processing unit which from the array of a predetermined number of pixels of an original image, creates a bit pattern indicative of the execution or nonexecution of a pixel copy onto a contracted image (or of an overlapping pixel copy onto an expanded image), by a digital differential analysis; a pattern table which stores therein a plurality of different bit patterns obtained by shifting the bit pattern created by the DDA processing unit in series by a predetermined number of bits; and a copy processing unit which when extracting a pixel string of the bit pattern length from the original image to transform it into a contracted image (or an expanded image), iterates processing for selecting a specific bit pattern from the pattern table by use of a random number to transform pixels of the original image into pixels of the contracted image(or of the expanded image). In this manner, by creating in advance the pattern table instead of calculating for each pixel thinning upon the contraction (or each pixel overlapping upon the expansion) by the digital differential analysis algorithm, it is possible to reduce the amount of calculation involved in the digital differential analysis algorithm to thereby speed up the processing. The number of the patterns enough to prevent the occurrence of the interference fringes can be 16 for example whereby the size transformation is possible to any desired size without holding a great number of overlapping patterns or thinning patterns. Upon the image contraction by this image size transforming apparatus, the DDA processing unit figures out a DDA sum total at a current pixel position by adding a contracted image size to an initialized DDA sum total, at an original image pixel initial position, but to a DDA sum total figured out at an immediately previous pixel position, at the other pixel positions, the DDA processing unit, if the DDA sum total is not less than the original image size, imparting bit information indicative of a pixel copy to the bit pattern and defining the result of subtraction of the image size from the current DDA sum total as the DDA sum total at the next pixel position, the DDA processing unit, if the DDA sum total is less than the original image size, imparting the other bit information indicative of thinning in place of the copy to the bit pattern and defining the current DDA sum total as the DDA sum total at the next pixel position, the DDA processing unit iterating the above processings to thereby create the plurality of different bit patterns. In this case, the copy processing unit defines the remainder when the random number is divided by the number of bit patterns, as a pattern selection value. The copy processing unit generates the random numbers for selecting the bit patterns, by use of a random number table, to thereby achieve a speedup of the processing.
The image size transforming apparatus of the present invention further comprises a bit/byte converting unit which converts binary pixel 1-bit data of the original image into 1-byte data, which are stored in an intermediate buffer to allow the copy processing unit to make image size transform byte processing; and a byte/bit converting unit which inversely converts the intermediate buffer image 1-byte data after copy processing into original 1-bit data to create a contracted image. In this manner, in spite of the bit representation of the original image, a high-speed processing can be achieved by converting the bit data into byte data and storing them into the intermediate buffer to perform the original image overlapping interpolation or thinning in the easy-to-process byte data format.
According to a third aspect of the present invention there is provided an image size transforming method comprising an initial value setting step which includes setting a random number based initial value as a sum total initial value of a digital differential analysis (DDA) and a DDA processing step which includes creating an image expanded or contracted from an original image by the digital differential analysis; the initial value setting step including determining a random number for each pixel initial position of the original image and defining the remainder when the random number is divided by the original image size as a DDA sum total initial value; the DDA processing step including, upon the image contraction, figuring out a DDA sum total at a current pixel position by adding a contracted image size to an initialized DDA sum total, at an original image pixel initial position, but to a DDA sum total figured out at an immediately previous pixel position, at the other pixel positions, the DDA processing step including, if the DDA sum total is not less than the original image size, copying pixels at the current pixel position onto a contracted image and defining the result of subtraction of the image size from the current DDA sum total as the DDA sum total at the next pixel position, the DDA processing step including, if the DDA sum total is less than the original image size, thinning out pixels at the current pixel position without copy thereof and defining the current DDA sum total as the DDA sum total at the next pixel position, the DDA processing step including iterating the above processings.
According to a fourth aspect of the present invention there is provided an image size transforming method comprising a DDA processing step which includes, from the array of a predetermined number of pixels of an original image, creating a bit pattern indicative of the execution or nonexecution of a pixel copy onto a contracted image or of an overlapping pixel copy onto an expanded image, by a digital differential analysis (DDA); a table creating step which includes creating a pattern table that stores therein a plurality of different bit patterns obtained by shifting the bit pattern created in the DDA processing step in series by a predetermined number of bits; and a copy processing step which includes, when extracting a pixel string of the bit pattern length from the original image to transform it into a contracted image or an expanded image iterating processing for selecting a specific bit pattern from the pattern table by use of a random number to transform pixels of the original image into pixels of the contracted image or of the expanded image.
In this image size transforming method, the DDA processing step includes, upon the image contraction, figuring out a DDA sum total at a current pixel position by adding a contracted image size to an initialized DDA sum total, at an original image pixel initial position, but to a DDA sum total figured out at an immediately previous pixel position, at the other pixel positions, the DDA processing step includes, if the DDA sum total is not less than the original image size, imparting bit information indicative of a pixel copy to the bit pattern and defining the result of subtraction of the image size from the current DDA sum total as the DDA sum total at the next pixel position, the DDA processing step includes, if the DDA sum total is less than the original image size, imparting the other bit information indicative of thinning in place of the copy to the bit pattern and defining the current DDA sum total as the DDA sum total at the next pixel position, the DDA processing unit iterating the above processings to thereby create the plurality of different bit patterns.
According to a fifth aspect of the present invention there is provided a computer readable record medium storing an image size transforming program therein, the image size transforming program comprising an initial value setting step which includes setting a random number based initial value as a sum total initial value of a digital differential analysis (DDA); and a DDA processing step which includes creating an image expanded or contracted from an original image by the digital differential analysis; the initial value setting step including determining a random number for each pixel initial position of the original image and defining the remainder when the random number is divided by the original image size as a DDA sum total initial value; the DDA processing step including, upon the image contraction, figuring out a DDA sum total at a current pixel position by adding a contracted image size to an initialized DDA sum total, at an original image pixel initial position, but to a DDA sum total figured out at an immediately previous pixel position, at the other pixel positions, the DDA processing step including, if the DDA sum total is not less than the original image size, copying pixels at the current pixel position onto a contracted image and defining the result of subtraction of the image size from the current DDA sum total as the DDA sum total at the next pixel position, the DDA processing step including, if the DDA sum total is less than the original image size, thinning out pixels at the current pixel position without copy thereof and defining the current DDA sum total as the DDA sum total at the next pixel position, the DDA processing step including iterating the above processings.
According to a sixth aspect of the present invention there is provided a computer readable record medium storing an image size transforming program therein, the image size transforming program comprising a DDA processing step which includes, from the array of a predetermined number of pixels of an original image, creating a bit pattern indicative of the execution or nonexecution of a pixel copy onto a contracted image or of an overlapping pixel copy onto an expanded image, by a digital differential analysis (DDA); a table creating step which includes creating a pattern table that stores therein a plurality of different bit patterns obtained by shifting the bit pattern created in the DDA processing step in series by a predetermined number of bits; and a copy processing step which includes, when extracting a pixel string of the bit pattern length from the original image to transform it into a contracted image or an expanded image, iterating processing for selecting a specific bit pattern from the pattern table by use of a random number to transform pixels of the original image into pixels of the contracted image or of the expanded image.
The DDA processing step of the image size transforming program stored in this storage medium includes, upon the image contraction, figuring out a DDA sum total at a current pixel position by adding a contracted image size to an initialized DDA sum total, at an original image pixel initial position, but to a DDA sum total figured out at an immediately previous pixel position, at the other pixel positions, the DDA processing step includes, if the DDA sum total is not less than the original image size, imparting bit information indicative of a pixel copy to the bit pattern and defining the result of subtraction of the image size from the current DDA sum total as the DDA sum total at the next pixel position, the DDA processing step includes, if the DDA sum total is less than the original image size, imparting the other bit information indicative of thinning in place of the copy to the bit pattern and defining the current DDA sum total as the DDA sum total at the next pixel position, the DDA processing unit iterating the above processings to thereby create the plurality of different bit patterns.
The above and other objects, aspects, features and advantages of the present invention will become more apparent from the following detailed description with reference to the accompanying drawings.